<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title></title>
    <script src="../js/mui.min.js"></script>
    <link href="../css/mui.css" rel="stylesheet"/>
    <link href="../css/style.css" rel="stylesheet"/>
</head>
<body>
    <header class="mui-bar mui-bar-nav">
      <a id="back" class="mui-icon mui-icon-arrowleft"></a>
      <h1 class="mui-title">北斗智慧派车</h1>
    </header>
    
    <!-- 主页面内容容器 -->
    <div class="mui-content">
 		<div id="slider" class="mui-slider">
			<div id="sliderSegmentedControl" class="mui-slider-indicator mui-segmented-control mui-segmented-control-inverted">
				<a class="mui-control-item mui-col-xs-6 mui-active" href="#item1mobile" data-wid="tab-top-subpage-unfinish.html">
					未完派单
				</a>
				<a class="mui-control-item mui-col-xs-6" href="#item2mobile" data-wid="tab-top-subpage-finished.html">
					完成派单
				</a>
			</div>
			<div id="sliderProgressBar" class="mui-slider-progress-bar mui-col-xs-6">
				
			</div>
			
		</div>
	</div>  
	<script src="../js/webviewGroup.js" type="text/javascript" charset="utf-8"></script>
	<script src="../js/app.js" type="text/javascript" charset="utf-8"></script>

	<script>
		mui.init();
		
		(function($) {
			mui.plusReady(function() {	
				var _self = plus.webview.currentWebview();
				var width = window.screen.width;
				var transX = 0;
				var group = new webviewGroup(_self.id, {
					items: [{
						id: "tab-top-subpage-unfinish.html",
						url: "./tab-top-subpage-unfinish.html",
						extras: {}
					}, {
						id: "tab-top-subpage-finished.html",
						url: "./tab-top-subpage-finished.html",
						extras: {}
					}],
					onChange: function(obj) {
						var c = document.querySelector(".mui-control-item.mui-active");
						if(c) {
							c.classList.remove("mui-active");
						}
						var target = document.querySelector(".mui-control-item:nth-child(" + (parseInt(obj.index) + 1) + ")");
						target.classList.add("mui-active");
						if(target.scrollIntoView) {
							target.scrollIntoView();
						}
						
						//添加滑动后较卡
						if(obj.index == 0) {
							if(transX != 0){
								transX = 0;
								var sliderProgressBar = document.getElementById("sliderProgressBar");
								var style = "transform: translate3d("+transX+"px, 0px, 0px)";
								sliderProgressBar.setAttribute('style', style);
							}
						}else if(obj.index == 1) {
							if(transX != width / 2){
								transX = width / 2;
								var sliderProgressBar = document.getElementById("sliderProgressBar");
								var style = "transform: translate3d("+transX+"px, 0px, 0px)";
								sliderProgressBar.setAttribute('style', style);
							}
						}
					}
				});
				
				mui(".mui-slider").on("tap", ".mui-control-item", function(e) {
					var wid = this.getAttribute("data-wid");
					group.switchTab(wid);
				});
			});
			
			mui.back = function() {
				var _self = plus.webview.currentWebview();
				_self.close("auto");
			}
			
			mui('#back')[0].addEventListener('tap', function(){
				mui.back();
			})
		})(mui, document);
	</script>
</body>
</html>